/**
 * Copyright © 2013 Creativor Studio.
 * About license information, please see LICENSE.txt.
 */
package org.creativor.rayson.share.transport;

/**
 * An tool used to parse the buffer data .
 * 
 * @author creativor
 */
public interface BufferParser {

	/**
	 * Compact the parser positions.
	 */
	void compactPositions();

	/**
	 * Consume one byte b from data buffer object. Caller will make sure that
	 * the given byte can be consumed by this consumer.
	 * 
	 * @param b
	 *            One byte to consume.
	 * @throws BufferFormatException
	 *             If the buffer data format is wrong. @ return True if the date
	 *             is consumed. Or else, return false.
	 */
	boolean consume(byte b) throws BufferFormatException;
}
